package com.jy.api.signUpReq;

import com.jy.api.util.UuidUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;

/**
 * Created by xiaohua on 2019/9/4.
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ProductDatRes {

    private String date;

    private List<ProductData> list;


    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class  ProductData {
        private String id = UuidUtil.getUuid();
        private String storeId;
        private String typeName;
        private Date date;
        private BigDecimal amount;
        private long qty;



        public ProductData(String s, String storeId, Date date) {
            this.id = UuidUtil.getUuid();
            this.storeId=storeId;
            this.typeName=s;
            this.date=date;
            this.amount=new BigDecimal(0);
            this.qty=0;

        }

        public ProductData(String k, String storeId, String date) {
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            simpleDateFormat.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
            try {
                Date   parse = simpleDateFormat.parse(date + " 00:00:00");
                this.date=parse;
            } catch (ParseException e) {
                e.printStackTrace();
            }
            this.id = UuidUtil.getUuid();
            this.storeId=storeId;
            this.typeName=k;
            this.amount=new BigDecimal(0);
            this.qty=0;
        }

        public ProductData(ProductData data) {
            this.date=data.getDate();
            this.id = data.getId();
            this.storeId=data.getStoreId();
            this.typeName=data.getTypeName();
            this.amount=data.getAmount();
            this.qty=data.getQty();

        }
    }










}
